package edu.sfsu.powerrangers.jeopardy.editor;

import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import javax.swing.JMenuItem;
import javax.swing.KeyStroke;

public class QuitMenuItem extends JMenuItem {
	private static final long serialVersionUID = 1L;
	
	public QuitMenuItem() {
		super("Exit");
		try {
			String os = System.getProperty("os.name");
			if (os.toLowerCase().contains("mac os")) {
				setText("Quit");
			}
		} catch (Exception e) {}
		setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
		addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				System.exit(0);
			}
		});
	}
}
